The present invention relates to a multitasking system for inner loops, such as a DO loop, in a multiprocessor system for use in information processing.
Multitasking of inner loops, such as the DO loop, in a program is now achieved in a multiprocessor system provided with a main storage accessible from a plurality of processors and from each of the processors. This multitasking results in the simultaneous presence and processing of a plurality of tasks, which are the smallest manageable units in an operating system (OS). Thus, the simultaneous processing would take place among tasks into which a job is divided. This makes it necessary for the OS to have a function which controls data sharing and the synchronism of events among tasks. Usually, a common routine and disk files are used in multitasking.
This multitasking enables a plurality of tasks to be executed in parallel on a plurality of processors to increase the execution speed of inner loops.
In this multitasking of inner loops, the start and end values of loop variables pertaining to loops are set in a single register shared by more than one processor to initiate each task. Each of the initiated tasks compares the start and end values by referring to the start and end values in the shared register while excluding simultaneous reference to the shared register with any other task and its updating. Each task, is this comparison shows that the start value is not greater than the end value, increases the start value in the shared register by an increment corresponding to a single loop, and at the same time executes the loop at that start value. By this method, each processor refers to a single register shared by the processors every time each processor executes a task. As a result, there is the possibility that contention for reference to the shared register occurs as many times as the loop is executed, and this contention increases the time taken to execute the procedure.
By another method, the frequency of contention for reference to the shared register may be reduced by having the programmer designate the number of loops to be executed by a task at a time. This method requires trial and error to find the appropriate value. It further is unable to cope with the unevenness of execution times in iterating a loop, resulting in a corresponding increase in the time taken to execute the procedure.
An object of the present information, therefore, is to provide a multitasking system for inner loops so designed as to reduce the possible occurrence of contention for reference to the register shared by more than one processor and thereby to increase the execution speed by multitasking the inner loops.